package com.gg.user.gguser.dao;

import com.gg.user.gguser.dataobject.GgInvitationCodeDataobject;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author yangxinlei
 * @date 2020/4/24
 */
@Mapper
public interface GgInvitationCodeDaoMapper {

    @Insert("insert into gg_invitation_code(gg_ic_establish_user, gg_Invitation_code) values (#{ggIcEstablishUser}, #{ggInvitationCode})")
    Integer addInvitationCode(@Param("ggIcEstablishUser")String ggIcEstablishUser,@Param("ggInvitationCode")String ggInvitationCode);

    @Select("select gg_ic_id as ggIcId,gg_ic_establish_user as ggIcEstablishUser,gg_Invitation_code as ggInvitationCode,gg_creation_time as ggCreationTime,gg_modification_time as ggModificationTime from gg_invitation_code where gg_ic_establish_user=#{ggIcEstablishUser}")
    List<GgInvitationCodeDataobject> getInvitationCode(@Param("ggIcEstablishUser")String ggIcEstablishUser);


    @Select("select gg_ic_id as ggIcId,gg_ic_establish_user as ggIcEstablishUser,gg_Invitation_code as ggInvitationCode,gg_creation_time as ggCreationTime,gg_modification_time as ggModificationTime from gg_invitation_code where gg_Invitation_code=#{ggIcEstablishUser}")
    GgInvitationCodeDataobject getInvitationUser(@Param("ggIcEstablishUser")String ggIcEstablishUser);
}
